home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: red/black trees ?
- Date: 22 Jan 1996 08:26:38 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4e0druINN5fn@keats.ugrad.cs.ubc.ca>
- References: <DLBpME.48G@gil.com.au>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <DLBpME.48G@gil.com.au>,
- Simon Knight <simnight@gil.ipswichcity.qld.gov.au> wrote:
- >Red/black trees have been mentioned in a number of magazines I have
- >read recently. Does anyone know what the algorithm is? How do they
- >compare with 2-3 trees, splay trees etc.
-
- I don't know how they compare.
-
- Most of the operations for red-black trees are O(log n), where n is the size of
- the data that you are putting into the tree. These operations include
- insertion, deletion and finding the maximum/minimum node according to the
- tree's order.
-
- The red-black method assures that the tree is always sufficiently balanced so
- that the deepest node is never more than twice as deep as the shallowest node.
- This still gives you O(log n) behavior, but with better constants than AVL
- trees. The reason is than an AVL tree, although having more "perfect"
- balancing, requires more overhead to maintain.
-
- Due to the O(log n) of insertion, and of finding and deleting the highest node,
- you can use a r/b tree as a priority queue implementation instead of a heap.
- --
-
-